<!--智能回复-->
{include file="public/header"}
<div class="content">
<div class="page-inner">
<div class="row">
<div class="col-md-12">
<div class="card">
	<div class="card-header">
		<h4 class="card-title">设置推送 <sub>群组id {$data.group_id}&nbsp;&nbsp;</sub></h4>
	</div>
	<div class="form-group">
	    <form>
	    <div style="width:180px;">
		<label for="defaultSelect">选择消息(关键词)</label>
		<select class="form-control form-control" id="type">
		    {volist name="data.api_gid" id="api_gid"}
			<option value="{$api_gid.id}">{$api_gid.keywords}</option>
			{/volist}
		</select>
		</div>
		<br>
		
    	<label for="successInput">设置时间多久一次</label>
    	<input type="number" id="time" value="" class="form-control" placeholder="单位秒" >		
		
        <br>
        </form>
        		<button type="submit" onclick="add_api()" class="btn btn-success">保存</button>
	</div>



	
</div>
</div>
</div>
</div>
</div>

{include file="public/footer"}
<script src="https://cdn.bootcdn.net/ajax/libs/layer/3.5.1/layer.js"></script>
<script>

function add_api(){
        
        var api_id = $('#type').val();
        var chat_id = "{$data.group_id}";
        var time = $('#time').val();
      
        
        $.post('/corn_add2',{'api_id':api_id,'chat_id':chat_id,'time':time},function(res){
            if(res.code>0){
                $.notify({
                	icon: 'flaticon-alarm-1',
                	title: '操作提示',
                	message: res.msg,
                },{
                	type: 'info',
                	placement: {
                		from: "bottom",
                		align: "right"
                	},
                	time: 1000,
                });
            }else{

               $.notify({
                	icon: 'flaticon-alarm-1',
                	title: '操作提示',
                	message: res.msg,
                },{
                	type: 'info',
                	placement: {
                		from: "bottom",
                		align: "right"
                	},
                	time: 1000,
                });
                setTimeout(function(){location.reload()},800);
            }
        },'json');
        
    }
  
</script>